#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <cutils/log.h>
#include <stdlib.h>
#include <fcntl.h>
#define PATH "/dev/disp"
enum DISP_CMD {
    DISP_CMD_LCD_ENABLE = 0x100,
    DISP_CMD_LCD_DISABLE = 0x101,
    DISP_CMD_LCD_SET_BRIGHTNESS = 0x102,
    DISP_CMD_LCD_GET_BRIGHTNESS = 0x103,
    DISP_CMD_LCD_BACKLIGHT_ENABLE  = 0x104,
    DISP_CMD_LCD_BACKLIGHT_DISABLE  = 0x105,

};


int lcd_power(int enable) {
    int fd;
    int ret;

    unsigned long arg[4] = {0};
    arg[0] = 0;
    fd = open(PATH, O_RDWR);
    if (fd < 0) {
        SLOGE("open %s fail, err= %s\n", PATH, strerror(errno));
        return -1;
    }

    int cmd;
    if (enable)
        cmd = DISP_CMD_LCD_ENABLE;
    else 
        cmd = DISP_CMD_LCD_DISABLE;
    //SLOGE("enable = %d", enable);
    ret = ioctl(fd, cmd, arg);
    SLOGE("ret = %x", ret);
    close(fd);


    return 0;
}
